RegisterEvent anonymous functions implementation (Additionally prevent CreateEventTimer() to register the same event more than one time)#474
Conversation
…FromCustomEvent that was crashing the server on script reload, mStateFunctionQueue is now a deque additionally createEventTimer cant register the same event more than one time now
|
When trying to add more than one event timer it break tho idk how to fix 🫡 |
|
seems like i found the issues now it doesnt crash anymore |
Fixed stack exceptions and lua panic inside StateThreadData::operator()()
|
took me alot of time to debug everything that needed to be debugged but i think its good now, also i now use a shared_ptr for LuaFunction to prevent issues with the lua reference and it seems to work, and the events are properly cleared on hotreload now |
SaltySnail
left a comment
There was a problem hiding this comment.
Nice work, small changes requested.
lionkor
left a comment
There was a problem hiding this comment.
I had a look since I was looking for the stability improvements, and saw a couple things. Hope it's okay :)
|
Also the vector to dequeue change should only make it faster if we pop from the front, if we pop from the back, we don't need to memcpy and it shouldn't make a difference which one is used. |
yes its better because its doing alot of |


This PR implements the usage of the function directly inside RegisterEvent() while keeping the possibility of using the function name.
This needed A LOT of changes; since I'm still a beginner in C++, there are probably a couple of issues that I would be happy to fix (can't imagine that there aren't any).
If this gets merged, it would be better to merge it before #473 to prevent conflicts regarding the
DontCallOnInitvariable that isn't completely removed in this PR but is in #473.ofc, I tested every changeand it seemed to work well (im just not sure about the
queuedlua console cmd)Closes #449
Closes #441 the panichandler is fixed in this PR
By creating this pull request, I understand that code that is AI generated or otherwise automatically generated may be rejected without further discussion.
I declare that I fully understand all code I pushed into this PR, and wrote all this code myself and own the rights to this code.